/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  
  checkConfig(config);
  @endpoint = getEndpoint('amqp-open', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model DataValue = {
  masterUid?: long(name='masterUid', description='The Alibaba Cloud account ID or Resource Access Management (RAM) user to which the AccessKey pair that is used to create the static username and password belongs.', example='1565************1'),
  cInstanceId?: string(name='cInstanceId', description='The ID of the ApsaraMQ for RabbitMQ instance.', example='amqp-cn-uqm******03'),
  accessKey?: string(name='accessKey', description='The AccessKey ID that is used to create the static username and password.', example='LTAI****************'),
  userName?: string(name='userName', description='The static username.', example='MjphbXFwLWNuLXVxbTJ6cjc2djAwMzpMVEFJNX*******ZNMWVSWnRFSjZ2Zm8='),
  password?: string(name='password', description='The static password.', example='OUYwQzM2QjZBRkUxNDRFM***************MzZCNzdDQzoxNjcxNDMwMzkyODI1'),
  deleted?: long(name='deleted', description='The timestamp that indicates when the static username and password were deleted. Unit: milliseconds.', example='1671175303522'),
  createTimestamp?: long(name='createTimestamp', description='The timestamp that indicates when the static username and password were created. Unit: milliseconds.', example='1671175303522'),
}

model CreateAccountRequest {
  accountAccessKey?: string(name='accountAccessKey', description='The AccessKey ID of your Alibaba Cloud account or RAM user. For information about how to obtain an AccessKey pair, see [Create an AccessKey pair](https://help.aliyun.com/document_detail/116401.html).

>  If you use the pair of static username and password that is created by using the Accesskey pair of a RAM user to access ApsaraMQ for RabbitMQ to send and receive messages, make sure that the RAM user is granted the required permissions. For more information, see [RAM policies](https://help.aliyun.com/document_detail/146559.html).

This parameter is required.', example='yourAccessKeyID'),
  createTimestamp?: long(name='createTimestamp', description='The timestamp that indicates when the password is created. Unit: milliseconds.

>  This timestamp is specified by you and is used to generate a static password. The timestamp is not the timestamp that indicates when the system generates the password.

This parameter is required.', example='1671175303522'),
  instanceId?: string(name='instanceId', description='The ID of the instance for which you want to create a pair of static username and password.

This parameter is required.', example='amqp-cn-*********'),
  secretSign?: string(name='secretSign', description='The AccessKey secret signature. The system generates a static password based on the signature in the request, the AccessKey secret signature, and the username.

The system uses the HMAC-SHA1 algorithm to generate the AccessKey secret signature based on the timestamp that indicates when the username is created and the AccessKey ID. For more information, see the **"Sample code on how to generate a signature"** section of this topic.

This parameter is required.', example='4c1a6367ce4c4255e9617326f9133ac635******'),
  signature?: string(name='signature', description='The signature. The system generates a static password based on the signature in the request, the AccessKey secret signature, and the username.

The system uses the HMAC-SHA1 algorithm to generate the signature based on the timestamp that indicates when the username is created and the AccessKey ID. For more information, see the **"Sample code on how to generate a signature"** section of this topic.

This parameter is required.', example='22c2d7d1769cb53c5a6d9213248e2de524******'),
  userName?: string(name='userName', description='The static username that you want to create.

The value of this parameter is a Base64-encoded string that is generated based on the instance ID and AccessKey ID. For more information, see the "**Sample code on how to generate a username**" section of this topic.

This parameter is required.', example='Mjo****************'),
}

model CreateAccountResponseBody = {
  code?: int32(name='Code', description='The HTTP status code. The status code 200 indicates that the request was successful.', example='200'),
  data?: {
    accessKey?: string(name='AccessKey', description='The AccessKey ID that is used to create the password.', example='LTAI****************'),
    createTimeStamp?: long(name='CreateTimeStamp', description='The timestamp that indicates when the password was created. Unit: milliseconds.', example='1671175303522'),
    instanceId?: string(name='InstanceId', description='The ID of the ApsaraMQ for RabbitMQ instance.', example='amqp-cn-*********'),
    masterUId?: long(name='MasterUId', description='The Alibaba Cloud account ID or RAM user to which the AccessKey pair that is used to create the static username and password belongs.', example='15657*********01'),
    password?: string(name='Password', description='The created static password.', example='NEMxQTYzNjdDRTVDNDI1NUU5NjE3**************1MzNGODoxNjcxMTc1MzEzNTIy'),
    userName?: string(name='UserName', description='The created static username.', example='MjphbXFwLWNuLXVxbTJ6cjc2djAwMzpMVEFJNX*******ZNMWVSWnRFSjZ2Zm8='),
  }(name='Data', description='The returned data.'),
  message?: string(name='Message', description='The returned message.', example='operation success'),
  requestId?: string(name='RequestId', description='The request ID.', example='92385FD2-624A-48C9-8FB5-753F2AFA***'),
  success?: boolean(name='Success', description='Indicates whether the call is successful.', example='true'),
}

model CreateAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateAccountResponseBody(name='body'),
}

/**
 * @summary Creates a pair of static username and password. If you access an ApsaraMQ for RabbitMQ broker from an open source RabbitMQ client, you must use a pair of username and password for authentication. You can access the ApsaraMQ for RabbitMQ broker only after the authentication is passed. ApsaraMQ for RabbitMQ allows you to generate usernames and passwords by using AccessKey pairs provided by Alibaba Cloud Resource Access Management (RAM).
 *
 * @param request CreateAccountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateAccountResponse
 */
async function createAccountWithOptions(request: CreateAccountRequest, runtime: Util.RuntimeOptions): CreateAccountResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountAccessKey)) {
    query['accountAccessKey'] = request.accountAccessKey;
  }
  if (!Util.isUnset(request.createTimestamp)) {
    query['createTimestamp'] = request.createTimestamp;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['instanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.secretSign)) {
    query['secretSign'] = request.secretSign;
  }
  if (!Util.isUnset(request.signature)) {
    query['signature'] = request.signature;
  }
  if (!Util.isUnset(request.userName)) {
    query['userName'] = request.userName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateAccount',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a pair of static username and password. If you access an ApsaraMQ for RabbitMQ broker from an open source RabbitMQ client, you must use a pair of username and password for authentication. You can access the ApsaraMQ for RabbitMQ broker only after the authentication is passed. ApsaraMQ for RabbitMQ allows you to generate usernames and passwords by using AccessKey pairs provided by Alibaba Cloud Resource Access Management (RAM).
 *
 * @param request CreateAccountRequest
 * @return CreateAccountResponse
 */
async function createAccount(request: CreateAccountRequest): CreateAccountResponse {
  var runtime = new Util.RuntimeOptions{};
  return createAccountWithOptions(request, runtime);
}

model CreateBindingRequest {
  argument?: string(name='Argument', description='The key-value pairs that are configured for the headers attributes of a message. One or more key-value pairs can be concatenated to configure the headers attributes of a message. You must specify the x-match attribute as one of the valid values. You can specify custom values for other attributes. Valid values of the x-match attribute:

*   \\\\*\\\\*all: \\\\*\\\\*A headers exchange routes a message to a queue only if all binding attributes of the queue except for x-match match the headers attributes of the message. This value is the default value.
*   \\\\*\\\\*any: \\\\*\\\\*A headers exchange routes a message to a queue if one or more binding attributes of the queue except for x-match match the headers attributes of the message.

Separate the attributes with semicolons (;). Separate the key and value of an attribute with a colon (:). Example: x-match:all;type:report;format:pdf. This parameter is available for only headers exchanges. You can set this parameter to an arbitrary value for other types of exchanges.', example='x-match:all;type:report;format:pdf'),
  bindingKey?: string(name='BindingKey', description='The binding key.

*   If the source exchange is not a topic exchange, the binding key must meet the following conventions:

    *   The binding key can contain only letters, digits, hyphens (-), underscores (_), periods (.), forward slashes (/), and at signs (@).
    *   The binding key must be 1 to 255 characters in length.

*   If the source exchange is a topic exchange, the binding key must meet the following conventions:

    *   The binding key can contain letters, digits, hyphens (-), underscores (_), asterisks (\\\\*), periods (.), number signs (#), forward slashes (/), and at signs (@).
    *   The binding key cannot start or end with a period (.). If a binding key starts with a number sign (#) or an asterisk (\\\\*), the number sign (#) or asterisk (\\\\*) must be followed by a period (.). If the binding key ends with a number sign (#) or an asterisk (\\\\*), the number sign (#) or asterisk (\\\\*) must be preceded by a period (.). If a number sign (#) or an asterisk (\\\\*) is used in the middle of a binding key, the number sign (#) or asterisk (\\\\*) must be preceded and followed by a period (.).
    *   The binding key must be 1 to 255 characters in length.', example='.test'),
  bindingType?: string(name='BindingType', description='The type of the object that you want to bind to the source exchange. Valid values:

*   \\\\*\\\\*0: \\\\*\\\\*Queue
*   \\\\*\\\\*1: \\\\*\\\\*Exchange

This parameter is required.', example='0'),
  destinationName?: string(name='DestinationName', description='The name of the object that you want to bind to the source exchange. You must create the object in the ApsaraMQ for RabbitMQ console in advance. The vhost of the object is the same as the vhost to which the source exchange specified by **SourceExchange** belongs. The vhost of the source exchange is the one specified by **VirtualHost**.

This parameter is required.', example='DemoQueue'),
  instanceId?: string(name='InstanceId', description='The ID of the ApsaraMQ for RabbitMQ instance.

This parameter is required.', example='amqp-cn-v0h1kb9nu***'),
  sourceExchange?: string(name='SourceExchange', description='The name of the source exchange. You must create the source exchange in the ApsaraMQ for RabbitMQ console in advance.

This parameter is required.', example='NormalEX'),
  virtualHost?: string(name='VirtualHost', description='The virtual host (vhost) name. You must create the vhost in the ApsaraMQ for RabbitMQ console in advance. The object specified by **DestinationName** and the source exchange specified by **SourceExchange** must belong to the vhost.

This parameter is required.', example='test'),
}

model CreateBindingResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='09768C14-E51C-4F4A-8077-30810032C***'),
}

model CreateBindingResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateBindingResponseBody(name='body'),
}

/**
 * @summary Creates a binding. In ApsaraMQ for RabbitMQ, after a producer sends a message to an exchange, the exchange routes the message to a queue or another exchange based on the binding relationship and the routing rule.
 *
 * @param request CreateBindingRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateBindingResponse
 */
async function createBindingWithOptions(request: CreateBindingRequest, runtime: Util.RuntimeOptions): CreateBindingResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.argument)) {
    body['Argument'] = request.argument;
  }
  if (!Util.isUnset(request.bindingKey)) {
    body['BindingKey'] = request.bindingKey;
  }
  if (!Util.isUnset(request.bindingType)) {
    body['BindingType'] = request.bindingType;
  }
  if (!Util.isUnset(request.destinationName)) {
    body['DestinationName'] = request.destinationName;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.sourceExchange)) {
    body['SourceExchange'] = request.sourceExchange;
  }
  if (!Util.isUnset(request.virtualHost)) {
    body['VirtualHost'] = request.virtualHost;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateBinding',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a binding. In ApsaraMQ for RabbitMQ, after a producer sends a message to an exchange, the exchange routes the message to a queue or another exchange based on the binding relationship and the routing rule.
 *
 * @param request CreateBindingRequest
 * @return CreateBindingResponse
 */
async function createBinding(request: CreateBindingRequest): CreateBindingResponse {
  var runtime = new Util.RuntimeOptions{};
  return createBindingWithOptions(request, runtime);
}

model CreateExchangeRequest {
  alternateExchange?: string(name='AlternateExchange', description='The alternate exchange. An alternate exchange is used to receive messages that fail to be routed to queues from the current exchange.', example='DemoAE'),
  autoDeleteState?: boolean(name='AutoDeleteState', description='Specifies whether to automatically delete the exchange. Valid values:

*   **true**: If the last queue that is bound to the exchange is unbound, the exchange is automatically deleted.
*   **false**: If the last queue that is bound to the exchange is unbound, the exchange is not automatically deleted.

This parameter is required.', example='false'),
  exchangeName?: string(name='ExchangeName', description='The name of the exchange that you want to create. The exchange name must meet the following conventions:

*   The name must be 1 to 255 characters in length, and can contain only letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).
*   After the exchange is created, you cannot change its name. If you want to change its name, delete the exchange and create another exchange.

This parameter is required.', example='DemoExchange'),
  exchangeType?: string(name='ExchangeType', description='The exchange type. Valid values:

*   **DIRECT**: An exchange of this type routes a message to the queue whose binding key is exactly the same as the routing key of the message.
*   **TOPIC**: This type of exchange is similar to direct exchanges. An exchange of this type routes a message to one or more queues based on the results of the fuzzy match or multi-condition match between the routing key of the message and the binding keys of the current exchange.
*   **FANOUT**: An exchange of this type routes all received messages to all queues bound to this exchange. You can use a fanout exchange to broadcast messages.
*   **HEADERS**: This type of exchange is similar to direct exchanges. The only difference is that a headers exchange routes messages based on the headers attributes instead of routing keys. When you bind a headers exchange to a queue, you must configure binding attributes in the key-value format for the binding. When you send a message to a headers exchange, you must configure the headers attributes in the key-value format for the message. After a headers exchange receives a message, the exchange routes the message based on the matching results between the headers attributes of the message and the binding attributes of the bound queues.
*   **X-CONSISTENT-HASH**: An exchange of this type allows you to perform hash calculations on routing keys or header values and use consistent hashing to route a message to different queues.

This parameter is required.', example='DIRECT'),
  instanceId?: string(name='InstanceId', description='The ID of the ApsaraMQ for RabbitMQ for which you want to create an exchange.

This parameter is required.', example='amqp-cn-v0h1kb9nu***'),
  internal?: boolean(name='Internal', description='Specifies whether the exchange is an internal exchange. Valid values:

*   **false**
*   **true**

This parameter is required.', example='false'),
  virtualHost?: string(name='VirtualHost', description='The name of the vhost to which the exchange that you want to create belongs.

This parameter is required.', example='test'),
  XDelayedType?: string(name='XDelayedType'),
}

model CreateExchangeResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='021788F6-E50C-4BD6-9F80-66B0A19A6***'),
}

model CreateExchangeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateExchangeResponseBody(name='body'),
}

/**
 * @summary Creates an exchange. In ApsaraMQ for RabbitMQ, an exchange is used to route a message that is received from a producer to one or more queues or to discard the message. An exchange routes a message to queues by using the routing key and binding keys.
 *
 * @param request CreateExchangeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateExchangeResponse
 */
async function createExchangeWithOptions(request: CreateExchangeRequest, runtime: Util.RuntimeOptions): CreateExchangeResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.alternateExchange)) {
    body['AlternateExchange'] = request.alternateExchange;
  }
  if (!Util.isUnset(request.autoDeleteState)) {
    body['AutoDeleteState'] = request.autoDeleteState;
  }
  if (!Util.isUnset(request.exchangeName)) {
    body['ExchangeName'] = request.exchangeName;
  }
  if (!Util.isUnset(request.exchangeType)) {
    body['ExchangeType'] = request.exchangeType;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.internal)) {
    body['Internal'] = request.internal;
  }
  if (!Util.isUnset(request.virtualHost)) {
    body['VirtualHost'] = request.virtualHost;
  }
  if (!Util.isUnset(request.XDelayedType)) {
    body['XDelayedType'] = request.XDelayedType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateExchange',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates an exchange. In ApsaraMQ for RabbitMQ, an exchange is used to route a message that is received from a producer to one or more queues or to discard the message. An exchange routes a message to queues by using the routing key and binding keys.
 *
 * @param request CreateExchangeRequest
 * @return CreateExchangeResponse
 */
async function createExchange(request: CreateExchangeRequest): CreateExchangeResponse {
  var runtime = new Util.RuntimeOptions{};
  return createExchangeWithOptions(request, runtime);
}

model CreateInstanceRequest {
  autoRenew?: boolean(name='AutoRenew', description='Specifies whether to enable auto-renewal. Valid values:

*   true: enables auto-renewal.
*   false: disables auto-renewal. If you select this value, you must manually renew the instance.', example='AutoRenewal'),
  autoRenewPeriod?: int32(name='AutoRenewPeriod', description='The auto-renewal period. The unit of the auto-renewal period is specified by RenewalDurationUnit. Default value: Month.

>  This parameter takes effect only if you set AutoRenew to true. Default value: 1.', example='1'),
  clientToken?: string(name='ClientToken', description='The client token.', example='c2c5d1274axxxxxxxx'),
  edition?: string(name='Edition'),
  encryptedInstance?: boolean(name='EncryptedInstance', description='Specifies whether to enable storage encryption for the instance. This parameter is available only for exclusive instances.', example='false'),
  instanceName?: string(name='InstanceName', description='The name of the instance. We recommend that you specify a name that does not exceed 64 characters in length.', example='amqp-xxxxx'),
  instanceType?: string(name='InstanceType', description='The instance edition. Valid values if you create a subscription instance:

*   professional: Professional Edition.
*   enterprise: Enterprise Edition
*   vip: Enterprise Platinum Edition

If you create a serverless instance, you do not need to specify this parameter.', example='professional'),
  kmsKeyId?: string(name='KmsKeyId', description='The ID of the Key Management Service (KMS)-managed key used for storage encryption. This parameter is available only for exclusive instances and required only if you set EncryptedInstance to true. The key must meet the following conditions:

*   The key cannot be a service key.
*   The key must be in the Enabled state.
*   The key must be a symmetric key.
*   The key must be used for encryption and decryption.
*   After the key is expired or deleted, you cannot read or write data and exceptions can occur in the ApsaraMQ for RabbitMQ instance.', example='key-xxx'),
  maxConnections?: int32(name='MaxConnections', description='The maximum number of connections that can be established to the instance.

Configure this parameter based on the values provided on the [ApsaraMQ for RocketMQ buy page](https://common-buy.aliyun.com/?commodityCode=ons_onsproxy_pre).', example='50000'),
  maxEipTps?: long(name='MaxEipTps', description='The maximum number of Internet-based TPS on the instance.

Configure this parameter based on the values provided on the [ApsaraMQ for RocketMQ buy page](https://common-buy.aliyun.com/?commodityCode=ons_onsproxy_pre).', example='128'),
  maxPrivateTps?: long(name='MaxPrivateTps', description='The maximum number of virtual private cloud (VPC)-based transactions per second (TPS) on the instance.

Configure this parameter based on the values provided on the [ApsaraMQ for RocketMQ buy page](https://common-buy.aliyun.com/?commodityCode=ons_onsproxy_pre).', example='1000'),
  paymentType?: string(name='PaymentType', description='The billing method of the instance. Valid values:

*   Subscription: subscription instance
*   PayAsYouGo: serverless instance

This parameter is required.', example='Subscription'),
  period?: int32(name='Period', description='The subscription period. The unit of the subscription period is specified by periodCycle.

>  This parameter takes effect only if you set PaymentType to Subscription. Default value: 1.', example='1'),
  periodCycle?: string(name='PeriodCycle', description='The unit of the subscription period. Valid values:

*   Month
*   Year

This parameter is valid only if you set PaymentType to Subscription. Default value: Month.', example='Month'),
  provisionedCapacity?: int32(name='ProvisionedCapacity'),
  queueCapacity?: int32(name='QueueCapacity', description='The number of queues on the instance.

Configure this parameter based on the values provided on the [ApsaraMQ for RocketMQ buy page](https://common-buy.aliyun.com/?commodityCode=ons_onsproxy_pre).', example='1000'),
  renewStatus?: string(name='RenewStatus', description='The renewal status. This parameter is the same as AutoRenew. You can configure one of these parameters. Valid value:

*   AutoRenewal

>  If you configure both this parameter and AutoRenew, the value of this parameter is used.', example='false'),
  renewalDurationUnit?: string(name='RenewalDurationUnit', description='The unit of the auto-renewal period. Valid values:

*   Month
*   Year', example='Month'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the instance belongs.', example='rg-acfmvvajg5qkxhi'),
  serverlessChargeType?: string(name='ServerlessChargeType', description='The billing method of the serverless instance. Valid value:

*   onDemand: You are charged based on your actual usage.', example='onDemand'),
  storageSize?: int32(name='StorageSize', description='The storage capacity. Unit: GB. Valid values:

*   Professional Edition and Enterprise Edition instances: Set the value to 0.

>  The value 0 specifies that storage space is available for Professional Edition and Enterprise Edition instances, but no storage fees are generated.

*   Enterprise Platinum Edition instances: Set the value to m × 100, where m is an integer that ranges from 7 to 28.', example='7'),
  supportEip?: boolean(name='SupportEip', description='Specifies whether elastic IP addresses (EIPs) are supported. Valid values:

*   True
*   False', example='true'),
  supportTracing?: boolean(name='SupportTracing', description='Specifies whether to enable the message trace feature. Valid values:

*   true
*   false

> 

*   Enterprise Platinum Edition instances allow you to retain message traces for 15 days free of charge. If you create an Enterprise Platinum Edition instance, you can set this parameter only to true and TracingStorageTime only to 15.

*   For instances of other editions, you can set this parameter to true or false.', example='true'),
  tracingStorageTime?: int32(name='TracingStorageTime', description='The retention period of messages. Unit: days. Valid values:

*   3
*   7
*   15

This parameter is valid only if you set SupportTracing to true.', example='3'),
}

model CreateInstanceResponseBody = {
  code?: int32(name='Code', description='The HTTP status code. The status code 200 indicates that the request is successful.', example='200'),
  data?: any(name='Data', description='The ID of the created instance.', example='amqp-cn-xxxxx'),
  message?: string(name='Message', description='The returned message.', example='xxx failed,xxxx'),
  requestId?: string(name='RequestId', description='The request ID. You can use the ID to troubleshoot issues. This parameter is a common parameter.', example='CCBB1225-C392-480E-8C7F-D09AB2CD2***'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model CreateInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateInstanceResponseBody(name='body'),
}

/**
 * @summary Creates an ApsaraMQ for RabbitMQ instance.
 *
 * @description **Before you call this operation, make sure that you fully understand the [billing methods and pricing](https://help.aliyun.com/document_detail/606747.html) of ApsaraMQ for RabbitMQ.
 *
 * @param request CreateInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateInstanceResponse
 */
async function createInstanceWithOptions(request: CreateInstanceRequest, runtime: Util.RuntimeOptions): CreateInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.autoRenew)) {
    query['AutoRenew'] = request.autoRenew;
  }
  if (!Util.isUnset(request.autoRenewPeriod)) {
    query['AutoRenewPeriod'] = request.autoRenewPeriod;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.edition)) {
    query['Edition'] = request.edition;
  }
  if (!Util.isUnset(request.encryptedInstance)) {
    query['EncryptedInstance'] = request.encryptedInstance;
  }
  if (!Util.isUnset(request.instanceName)) {
    query['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.instanceType)) {
    query['InstanceType'] = request.instanceType;
  }
  if (!Util.isUnset(request.kmsKeyId)) {
    query['KmsKeyId'] = request.kmsKeyId;
  }
  if (!Util.isUnset(request.maxConnections)) {
    query['MaxConnections'] = request.maxConnections;
  }
  if (!Util.isUnset(request.maxEipTps)) {
    query['MaxEipTps'] = request.maxEipTps;
  }
  if (!Util.isUnset(request.maxPrivateTps)) {
    query['MaxPrivateTps'] = request.maxPrivateTps;
  }
  if (!Util.isUnset(request.paymentType)) {
    query['PaymentType'] = request.paymentType;
  }
  if (!Util.isUnset(request.period)) {
    query['Period'] = request.period;
  }
  if (!Util.isUnset(request.periodCycle)) {
    query['PeriodCycle'] = request.periodCycle;
  }
  if (!Util.isUnset(request.provisionedCapacity)) {
    query['ProvisionedCapacity'] = request.provisionedCapacity;
  }
  if (!Util.isUnset(request.queueCapacity)) {
    query['QueueCapacity'] = request.queueCapacity;
  }
  if (!Util.isUnset(request.renewStatus)) {
    query['RenewStatus'] = request.renewStatus;
  }
  if (!Util.isUnset(request.renewalDurationUnit)) {
    query['RenewalDurationUnit'] = request.renewalDurationUnit;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.serverlessChargeType)) {
    query['ServerlessChargeType'] = request.serverlessChargeType;
  }
  if (!Util.isUnset(request.storageSize)) {
    query['StorageSize'] = request.storageSize;
  }
  if (!Util.isUnset(request.supportEip)) {
    query['SupportEip'] = request.supportEip;
  }
  if (!Util.isUnset(request.supportTracing)) {
    query['SupportTracing'] = request.supportTracing;
  }
  if (!Util.isUnset(request.tracingStorageTime)) {
    query['TracingStorageTime'] = request.tracingStorageTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateInstance',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates an ApsaraMQ for RabbitMQ instance.
 *
 * @description **Before you call this operation, make sure that you fully understand the [billing methods and pricing](https://help.aliyun.com/document_detail/606747.html) of ApsaraMQ for RabbitMQ.
 *
 * @param request CreateInstanceRequest
 * @return CreateInstanceResponse
 */
async function createInstance(request: CreateInstanceRequest): CreateInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return createInstanceWithOptions(request, runtime);
}

model CreateQueueRequest {
  autoDeleteState?: boolean(name='AutoDeleteState', description='Specifies whether to automatically delete the queue. Valid values:

*   true: The queue is automatically deleted. After the last consumer unsubscribes from the queue, the queue is automatically deleted.
*   false: The queue is not automatically deleted.', example='false'),
  autoExpireState?: long(name='AutoExpireState', description='The validity period after which the queue is automatically deleted. If the queue is not accessed within the specified period of time, the queue is automatically deleted.

Unit: milliseconds.

>  You can use the feature that corresponds to this parameter only after you enable the feature. To enable the feature, [submit a ticket](https://ticket-intl.console.aliyun.com/#/ticket/createIndex).', example='10000'),
  deadLetterExchange?: string(name='DeadLetterExchange', description='The dead-letter exchange. A dead-letter exchange is used to receive rejected messages.

If a consumer rejects a message that cannot be redelivered, ApsaraMQ for RabbitMQ routes the message to the specified dead-letter exchange. Then, the dead-letter exchange routes the message to the queue that is bound to the dead-letter exchange for storage.', example='DLExchange'),
  deadLetterRoutingKey?: string(name='DeadLetterRoutingKey', description='The dead-letter routing key. The key must be 1 to 255 characters in length, and can contain only letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).', example='test.dl'),
  exclusiveState?: boolean(name='ExclusiveState', description='Specifies whether the exchange is an exclusive exchange. Valid values:

*   true: The exchange is an exclusive exchange. Only the connection that declares the exclusive exchange can use the exclusive exchange. After the connection is closed, the exclusive exchange is automatically deleted.
*   false: The exchange is not an exclusive exchange.', example='false'),
  instanceId?: string(name='InstanceId', description='The ID of the ApsaraMQ for RabbitMQ instance on which you want to create a queue.

This parameter is required.', example='amqp-cn-v0h1kb9nu***'),
  maxLength?: long(name='MaxLength', description='This parameter is unavailable in the current version of ApsaraMQ for RabbitMQ.

The maximum number of messages that can be stored in the queue. If this threshold is exceeded, the earliest stored messages in the queue are deleted.', example='1000'),
  maximumPriority?: int32(name='MaximumPriority', description='Queue priorities are not supported. The value does not affect the call or return results.', example='10'),
  messageTTL?: long(name='MessageTTL', description='The message time to live (TTL) of the queue.

*   If the retention period of a message in the queue exceeds the message TTL of the queue, the message expires.
*   The message TTL must be set to a non-negative integer. The maximum message TTL is one day. Unit: milliseconds. For example, if the message TTL is 1,000 milliseconds, the message can be retained for up to 1 second in the queue.', example='1000'),
  queueName?: string(name='QueueName', description='The name of the queue that you want to create.

*   The name must be 1 to 255 characters in length, and can contain only letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).
*   After the queue is created, you cannot change the name of the queue. If you want to change the name of the queue, delete the queue and create another queue.

This parameter is required.', example='DemoQueue'),
  virtualHost?: string(name='VirtualHost', description='The name of the vhost to which the queue that you want to create belongs. The name must be 1 to 255 characters in length, and can contain only letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).

This parameter is required.', example='test'),
}

model CreateQueueResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='59B52E2C-0B8E-44EC-A314-D0314A50***'),
}

model CreateQueueResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateQueueResponseBody(name='body'),
}

/**
 * @summary Creates a queue. In ApsaraMQ for RabbitMQ, a queue is a message queue. All messages in ApsaraMQ for RabbitMQ are sent to a specific exchange and then routed to a bound queue by the exchange.
 *
 * @param request CreateQueueRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateQueueResponse
 */
async function createQueueWithOptions(request: CreateQueueRequest, runtime: Util.RuntimeOptions): CreateQueueResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.autoDeleteState)) {
    body['AutoDeleteState'] = request.autoDeleteState;
  }
  if (!Util.isUnset(request.autoExpireState)) {
    body['AutoExpireState'] = request.autoExpireState;
  }
  if (!Util.isUnset(request.deadLetterExchange)) {
    body['DeadLetterExchange'] = request.deadLetterExchange;
  }
  if (!Util.isUnset(request.deadLetterRoutingKey)) {
    body['DeadLetterRoutingKey'] = request.deadLetterRoutingKey;
  }
  if (!Util.isUnset(request.exclusiveState)) {
    body['ExclusiveState'] = request.exclusiveState;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.maxLength)) {
    body['MaxLength'] = request.maxLength;
  }
  if (!Util.isUnset(request.maximumPriority)) {
    body['MaximumPriority'] = request.maximumPriority;
  }
  if (!Util.isUnset(request.messageTTL)) {
    body['MessageTTL'] = request.messageTTL;
  }
  if (!Util.isUnset(request.queueName)) {
    body['QueueName'] = request.queueName;
  }
  if (!Util.isUnset(request.virtualHost)) {
    body['VirtualHost'] = request.virtualHost;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateQueue',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a queue. In ApsaraMQ for RabbitMQ, a queue is a message queue. All messages in ApsaraMQ for RabbitMQ are sent to a specific exchange and then routed to a bound queue by the exchange.
 *
 * @param request CreateQueueRequest
 * @return CreateQueueResponse
 */
async function createQueue(request: CreateQueueRequest): CreateQueueResponse {
  var runtime = new Util.RuntimeOptions{};
  return createQueueWithOptions(request, runtime);
}

model CreateVirtualHostRequest {
  instanceId?: string(name='InstanceId', description='The ID of the ApsaraMQ for RabbitMQ instance.

This parameter is required.', example='amqp-cn-v0h1kb9n***'),
  virtualHost?: string(name='VirtualHost', description='The name of the vhost that you want to create. Valid values:

*   The name can contain letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slash (/), and at signs (@).
*   The name must be 1 to 255 characters in length.
*   After the vhost is created, you cannot change its name. If you want to change the name of a vhost, delete the vhost and create another vhost.

This parameter is required.', example='Demo'),
}

model CreateVirtualHostResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='628705FD-03EE-4ABE-BB21-E1672960***'),
}

model CreateVirtualHostResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateVirtualHostResponseBody(name='body'),
}

/**
 * @summary Creates a vhost. A vhost is used to logically isolate resources. Each vhost manages its own exchanges, queues, and bindings. Applications can run on independent vhosts in a secure manner. This way, the business of an application is not affected by other applications. Before you connect producers and consumers to an ApsaraMQ for RabbitMQ instance, you must specify vhosts for the producers and consumers.
 *
 * @param request CreateVirtualHostRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateVirtualHostResponse
 */
async function createVirtualHostWithOptions(request: CreateVirtualHostRequest, runtime: Util.RuntimeOptions): CreateVirtualHostResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.virtualHost)) {
    body['VirtualHost'] = request.virtualHost;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateVirtualHost',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a vhost. A vhost is used to logically isolate resources. Each vhost manages its own exchanges, queues, and bindings. Applications can run on independent vhosts in a secure manner. This way, the business of an application is not affected by other applications. Before you connect producers and consumers to an ApsaraMQ for RabbitMQ instance, you must specify vhosts for the producers and consumers.
 *
 * @param request CreateVirtualHostRequest
 * @return CreateVirtualHostResponse
 */
async function createVirtualHost(request: CreateVirtualHostRequest): CreateVirtualHostResponse {
  var runtime = new Util.RuntimeOptions{};
  return createVirtualHostWithOptions(request, runtime);
}

model DeleteAccountRequest {
  createTimestamp?: long(name='CreateTimestamp', description='The timestamp that indicates when the pair of static username and password that you want to delete was created. Unit: milliseconds.

You can call the [ListAccounts](https://help.aliyun.com/document_detail/472730.html) operation to view the timestamp.', example='1671175303522'),
  userName?: string(name='UserName', description='The pair of username and password that you want to delete.

This parameter is required.', example='MjphbXFwLWNuLXVxbTJ5cjc3djAwMzpMVEFJNXQ4YmVNbVZNMWVSWnRFSjZ2Zm1='),
}

model DeleteAccountResponseBody = {
  code?: int32(name='Code', description='The HTTP status code. The status code 200 indicates that the request is successful.', example='200'),
  data?: boolean(name='Data', description='The returned data.', example='true'),
  message?: string(name='Message', description='The returned message.', example='operation success'),
  requestId?: string(name='RequestId', description='The request ID.', example='021788F6-E50C-4BD6-9F80-66B0A19A6***'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model DeleteAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteAccountResponseBody(name='body'),
}

/**
 * @summary Deletes a pair of username and password.
 *
 * @param request DeleteAccountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteAccountResponse
 */
async function deleteAccountWithOptions(request: DeleteAccountRequest, runtime: Util.RuntimeOptions): DeleteAccountResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.createTimestamp)) {
    query['CreateTimestamp'] = request.createTimestamp;
  }
  if (!Util.isUnset(request.userName)) {
    query['UserName'] = request.userName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteAccount',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a pair of username and password.
 *
 * @param request DeleteAccountRequest
 * @return DeleteAccountResponse
 */
async function deleteAccount(request: DeleteAccountRequest): DeleteAccountResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteAccountWithOptions(request, runtime);
}

model DeleteBindingRequest {
  bindingKey?: string(name='BindingKey', description='The binding key.', example='.test.'),
  bindingType?: string(name='BindingType', description='The type of the object that you want to unbind from the source exchange. Valid values:

*   **QUEUE**
*   **EXCHANGE**

This parameter is required.', example='QUEUE'),
  destinationName?: string(name='DestinationName', description='The name of the object that you want to unbind from the source exchange.

This parameter is required.', example='DemoQueue'),
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='amqp-cn-v0h1kb9nu***'),
  sourceExchange?: string(name='SourceExchange', description='The name of the source exchange.

This parameter is required.', example='NormalEX'),
  virtualHost?: string(name='VirtualHost', description='The vhost name.

This parameter is required.', example='test'),
}

model DeleteBindingResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='021788F6-E50C-4BD6-9F80-66B0A19A6***'),
}

model DeleteBindingResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteBindingResponseBody(name='body'),
}

/**
 * @summary Deletes a binding to unbind a queue or an exchange from a source exchange.
 *
 * @param request DeleteBindingRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteBindingResponse
 */
async function deleteBindingWithOptions(request: DeleteBindingRequest, runtime: Util.RuntimeOptions): DeleteBindingResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.bindingKey)) {
    body['BindingKey'] = request.bindingKey;
  }
  if (!Util.isUnset(request.bindingType)) {
    body['BindingType'] = request.bindingType;
  }
  if (!Util.isUnset(request.destinationName)) {
    body['DestinationName'] = request.destinationName;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.sourceExchange)) {
    body['SourceExchange'] = request.sourceExchange;
  }
  if (!Util.isUnset(request.virtualHost)) {
    body['VirtualHost'] = request.virtualHost;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteBinding',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a binding to unbind a queue or an exchange from a source exchange.
 *
 * @param request DeleteBindingRequest
 * @return DeleteBindingResponse
 */
async function deleteBinding(request: DeleteBindingRequest): DeleteBindingResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteBindingWithOptions(request, runtime);
}

model DeleteExchangeRequest {
  exchangeName?: string(name='ExchangeName', description='The name of the exchange that you want to delete.

This parameter is required.', example='DemoExchange'),
  instanceId?: string(name='InstanceId', description='The ID of the ApsaraMQ for RabbitMQ instance whose exchange you want to delete.

This parameter is required.', example='amqp-cn-v0h1kb9nu***'),
  virtualHost?: string(name='VirtualHost', description='The vhost to which the exchange that you want to delete belongs.

This parameter is required.', example='test'),
}

model DeleteExchangeResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='6961FFB8-6358-4EDC-9E3C-4A0C56CE6***'),
}

model DeleteExchangeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteExchangeResponseBody(name='body'),
}

/**
 * @summary Deletes an exchange.
 *
 * @description ## [](#)Usage notes
 * *   You cannot delete exchanges of the **headers** and **x-jms-topic** types.
 * *   You cannot delete built-in exchanges in a vhost. These exchanges are amq.direct, amq.topic, and amq.fanout.
 *
 * @param request DeleteExchangeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteExchangeResponse
 */
async function deleteExchangeWithOptions(request: DeleteExchangeRequest, runtime: Util.RuntimeOptions): DeleteExchangeResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.exchangeName)) {
    body['ExchangeName'] = request.exchangeName;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.virtualHost)) {
    body['VirtualHost'] = request.virtualHost;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteExchange',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes an exchange.
 *
 * @description ## [](#)Usage notes
 * *   You cannot delete exchanges of the **headers** and **x-jms-topic** types.
 * *   You cannot delete built-in exchanges in a vhost. These exchanges are amq.direct, amq.topic, and amq.fanout.
 *
 * @param request DeleteExchangeRequest
 * @return DeleteExchangeResponse
 */
async function deleteExchange(request: DeleteExchangeRequest): DeleteExchangeResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteExchangeWithOptions(request, runtime);
}

model DeleteQueueRequest {
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='1880770869023***'),
  queueName?: string(name='QueueName', description='The queue name.

This parameter is required.', example='DemoQueue'),
  virtualHost?: string(name='VirtualHost', description='The vhost name.

This parameter is required.', example='Test'),
}

model DeleteQueueResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='92385FD2-624A-48C9-8FB5-753F2AFA***'),
}

model DeleteQueueResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteQueueResponseBody(name='body'),
}

/**
 * @summary Deletes a queue.
 *
 * @param request DeleteQueueRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteQueueResponse
 */
async function deleteQueueWithOptions(request: DeleteQueueRequest, runtime: Util.RuntimeOptions): DeleteQueueResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.queueName)) {
    body['QueueName'] = request.queueName;
  }
  if (!Util.isUnset(request.virtualHost)) {
    body['VirtualHost'] = request.virtualHost;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteQueue',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a queue.
 *
 * @param request DeleteQueueRequest
 * @return DeleteQueueResponse
 */
async function deleteQueue(request: DeleteQueueRequest): DeleteQueueResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteQueueWithOptions(request, runtime);
}

model DeleteVirtualHostRequest {
  instanceId?: string(name='InstanceId', description='The ID of the ApsaraMQ for RabbitMQ instance to which the vhost you want to delete belongs.

This parameter is required.', example='amqp-cn-v0h1kb9nu***'),
  virtualHost?: string(name='VirtualHost', description='The name of the vhost that you want to delete.

This parameter is required.', example='test'),
}

model DeleteVirtualHostResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='4311050D-BD63-48F9-822B-947A75A1***'),
}

model DeleteVirtualHostResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteVirtualHostResponseBody(name='body'),
}

/**
 * @summary Deletes a virtual host (vhost).
 *
 * @description Before you delete a vhost, make sure that all exchanges and queues in the vhost are deleted.
 *
 * @param request DeleteVirtualHostRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteVirtualHostResponse
 */
async function deleteVirtualHostWithOptions(request: DeleteVirtualHostRequest, runtime: Util.RuntimeOptions): DeleteVirtualHostResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.virtualHost)) {
    body['VirtualHost'] = request.virtualHost;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteVirtualHost',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a virtual host (vhost).
 *
 * @description Before you delete a vhost, make sure that all exchanges and queues in the vhost are deleted.
 *
 * @param request DeleteVirtualHostRequest
 * @return DeleteVirtualHostResponse
 */
async function deleteVirtualHost(request: DeleteVirtualHostRequest): DeleteVirtualHostResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteVirtualHostWithOptions(request, runtime);
}

model GetInstanceRequest {
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='amqp-cn-v0h1kb9nu***'),
}

model GetInstanceResponseBody = {
  data?: {
    autoRenewInstance?: boolean(name='AutoRenewInstance', example='false'),
    classicEndpoint?: string(name='ClassicEndpoint', example='amqp-cn-st21x7kv****.not-support'),
    encryptedInstance?: boolean(name='EncryptedInstance'),
    expireTime?: long(name='ExpireTime', example='1651507200000'),
    instanceId?: string(name='InstanceId', example='amqp-cn-*********'),
    instanceName?: string(name='InstanceName', example='yunQi-instance'),
    instanceType?: string(name='InstanceType', example='enterprise'),
    kmsKeyId?: string(name='KmsKeyId'),
    maxConnections?: int32(name='MaxConnections', example='1500'),
    maxEipTps?: int32(name='MaxEipTps', example='1000'),
    maxQueue?: int32(name='MaxQueue', example='1000'),
    maxTps?: int32(name='MaxTps', example='1000'),
    maxVhost?: int32(name='MaxVhost', example='50'),
    orderCreateTime?: long(name='OrderCreateTime', example='1651507200000'),
    orderType?: string(name='OrderType', example='PRE_PAID'),
    privateEndpoint?: string(name='PrivateEndpoint', example='amqp-cn-st21x7kv****.mq-amqp.cn-hangzhou-a.aliyuncs.com'),
    publicEndpoint?: string(name='PublicEndpoint', example='xxx.cn-hangzhou.xxx.net.mq.amqp.aliyuncs.com'),
    resourceGroupId?: string(name='ResourceGroupId'),
    status?: string(name='Status', example='SERVING'),
    storageSize?: int32(name='StorageSize', example='200'),
    supportEIP?: boolean(name='SupportEIP', example='true'),
    supportTracing?: boolean(name='SupportTracing', example='True'),
    tags?: [ 
      {
        key?: string(name='Key'),
        value?: string(name='Value'),
      }
    ](name='Tags'),
    tracingStorageTime?: int32(name='TracingStorageTime', example='15'),
  }(name='Data'),
  requestId?: string(name='RequestId', example='92385FD2-624A-48C9-8FB5-753F2AFA***'),
}

model GetInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetInstanceResponseBody(name='body'),
}

/**
 * @summary 获取实例详情
 *
 * @param request GetInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetInstanceResponse
 */
async function getInstanceWithOptions(request: GetInstanceRequest, runtime: Util.RuntimeOptions): GetInstanceResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetInstance',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取实例详情
 *
 * @param request GetInstanceRequest
 * @return GetInstanceResponse
 */
async function getInstance(request: GetInstanceRequest): GetInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return getInstanceWithOptions(request, runtime);
}

model GetMetadataAmountRequest {
  instanceId?: string(name='InstanceId', description='The ID of the ApsaraMQ for RabbitMQ instance.', example='amqp-cn-v0h1kb9n***'),
}

model GetMetadataAmountResponseBody = {
  data?: {
    currentExchanges?: int32(name='CurrentExchanges', description='The number of created exchanges on the ApsaraMQ for RabbitMQ instance.', example='7'),
    currentQueues?: int32(name='CurrentQueues', description='The number of created queues on the ApsaraMQ for RabbitMQ instance.', example='1'),
    currentVirtualHosts?: int32(name='CurrentVirtualHosts', description='The number of created vhosts on the ApsaraMQ for RabbitMQ instance.', example='1'),
    maxExchanges?: int32(name='MaxExchanges', description='The maximum number of exchanges that can be created on the ApsaraMQ for RabbitMQ instance.', example='20'),
    maxQueues?: int32(name='MaxQueues', description='The maximum number of queues that can be created on the ApsaraMQ for RabbitMQ instance.', example='20'),
    maxVirtualHosts?: int32(name='MaxVirtualHosts', description='The maximum number of vhosts that can be created on the ApsaraMQ for RabbitMQ instance.', example='10'),
  }(name='Data', description='The returned data.'),
  requestId?: string(name='RequestId', description='The request ID.', example='B75ACF23-2BEB-44AC-A0B6-AE14EDCA***'),
}

model GetMetadataAmountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetMetadataAmountResponseBody(name='body'),
}

/**
 * @summary Queries the maximum number of vhosts, exchanges, and queues that you can create and the number of created vhosts, exchanges, and queues on an ApsaraMQ for RabbitMQ instance.
 *
 * @param request GetMetadataAmountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetMetadataAmountResponse
 */
async function getMetadataAmountWithOptions(request: GetMetadataAmountRequest, runtime: Util.RuntimeOptions): GetMetadataAmountResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetMetadataAmount',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the maximum number of vhosts, exchanges, and queues that you can create and the number of created vhosts, exchanges, and queues on an ApsaraMQ for RabbitMQ instance.
 *
 * @param request GetMetadataAmountRequest
 * @return GetMetadataAmountResponse
 */
async function getMetadataAmount(request: GetMetadataAmountRequest): GetMetadataAmountResponse {
  var runtime = new Util.RuntimeOptions{};
  return getMetadataAmountWithOptions(request, runtime);
}

model ListAccountsRequest {
  instanceId?: string(name='InstanceId', description='The ID of the ApsaraMQ for RabbitMQ instance for which you want to query the static username and password.', example='amqp-cn-20p****04'),
}

model ListAccountsResponseBody = {
  code?: int32(name='Code', description='The HTTP status code. The status code 200 indicates that the call is successful.', example='200'),
  data?: map[string][ DataValue   ](name='Data', description='The returned data.'),
  message?: string(name='Message', description='The returned message.', example='operation success'),
  requestId?: string(name='RequestId', description='The request ID.', example='549A5A97-FE61-5A23-8126-3A11929C1EC4'),
  success?: boolean(name='Success', description='Indicates whether the call is successful.', example='True'),
}

model ListAccountsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListAccountsResponseBody(name='body'),
}

/**
 * @summary Queries the static username and password of an ApsaraMQ for RabbitMQ.
 *
 * @param request ListAccountsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListAccountsResponse
 */
async function listAccountsWithOptions(request: ListAccountsRequest, runtime: Util.RuntimeOptions): ListAccountsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAccounts',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the static username and password of an ApsaraMQ for RabbitMQ.
 *
 * @param request ListAccountsRequest
 * @return ListAccountsResponse
 */
async function listAccounts(request: ListAccountsRequest): ListAccountsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listAccountsWithOptions(request, runtime);
}

model ListBindingsRequest {
  instanceId?: string(name='InstanceId', description='The ID of the ApsaraMQ for RabbitMQ instance.

This parameter is required.', example='1880770869023***'),
  maxResults?: int32(name='MaxResults', description='The maximum number of entries to return. Valid values:

**1 to 100**

This parameter is required.', example='1'),
  nextToken?: string(name='NextToken', description='The token that marks the end position of the previous returned page. To obtain the next batch of data, call the operation again by using the value of NextToken returned by the previous request. If you call this operation for the first time or want to query all results, set NextToken to an empty string.', example='caeba0bbb2be03f84eb48b699f0a****'),
  virtualHost?: string(name='VirtualHost', description='The vhost name.

This parameter is required.', example='Test'),
}

model ListBindingsResponseBody = {
  data?: {
    bindings?: [ 
      {
        argument?: string(name='Argument', description='The x-match attribute. Valid values:

*   **all:** A headers exchange routes a message to a queue only if all binding attributes of the queue except for x-match match the headers attributes of the message. This value is the default value.
*   **any:** A headers exchange routes a message to a queue if one or more binding attributes of the queue except for x-match match the headers attributes of the message.

This parameter is available only for headers exchanges.', example='all'),
        bindingKey?: string(name='BindingKey', description='The binding key.

*   If the source exchange is not a topic exchange, the binding key must meet the following conventions:

    *   The binding key can contain only letters, digits, hyphens (-), underscores (_), periods (.), forward slashes (/), and at signs (@).
    *   The binding key must be 1 to 255 characters in length.

*   If the source exchange is a topic exchange, the binding key must meet the following conventions:

    *   The binding key can contain letters, digits, hyphens (-), underscores (_), asterisks (\\\\*), periods (.), number signs (#), forward slashes (/), and at signs (@).
    *   The binding key cannot start or end with a period (.). If a binding key starts with a number sign (#) or an asterisk (\\\\*), the number sign (#) or asterisk (\\\\*) must be followed by a period (.). If the binding key ends with a number sign (#) or an asterisk (\\\\*), the number sign (#) or asterisk (\\\\*) must be preceded by a period (.). If a number sign (#) or an asterisk (\\\\*) is used in the middle of a binding key, the number sign (#) or asterisk (\\\\*) must be preceded and followed by a period (.).
    *   The binding key must be 1 to 255 characters in length.', example='amq.test'),
        bindingType?: string(name='BindingType', description='The type of the object to which the source exchange is bound. Valid values:

*   **QUEUE**
*   **EXCHANGE**', example='QUEUE'),
        destinationName?: string(name='DestinationName', description='The name of the object to which the source exchange is bound.', example='QueueTest'),
        sourceExchange?: string(name='SourceExchange', description='The name of the source exchange.', example='test'),
      }
    ](name='Bindings', description='The bindings.'),
    maxResults?: int32(name='MaxResults', description='The maximum number of entries returned.', example='1'),
    nextToken?: string(name='NextToken', description='The token that marks the end of the current returned page. If this parameter is empty, all data is retrieved.', example='caebacccb2be03f84eb48b699f0a****'),
  }(name='Data', description='The returned data.'),
  requestId?: string(name='RequestId', description='The request ID.', example='E0A71208-3E87-4732-81CC-B18E0B4B1***'),
}

model ListBindingsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListBindingsResponseBody(name='body'),
}

/**
 * @summary Queries all bindings of a virtual host (vhost) on an ApsaraMQ for RabbitMQ instance.
 *
 * @param request ListBindingsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListBindingsResponse
 */
async function listBindingsWithOptions(request: ListBindingsRequest, runtime: Util.RuntimeOptions): ListBindingsResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListBindings',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries all bindings of a virtual host (vhost) on an ApsaraMQ for RabbitMQ instance.
 *
 * @param request ListBindingsRequest
 * @return ListBindingsResponse
 */
async function listBindings(request: ListBindingsRequest): ListBindingsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listBindingsWithOptions(request, runtime);
}

model ListDownStreamBindingsRequest {
  exchangeName?: string(name='ExchangeName', description='The exchange name.

This parameter is required.', example='test'),
  instanceId?: string(name='InstanceId', description='The ID of the ApsaraMQ for RabbitMQ instance to which the exchange belongs.

This parameter is required.', example='1880770869023***'),
  maxResults?: int32(name='MaxResults', description='The maximum number of entries to return.', example='1'),
  nextToken?: string(name='NextToken', description='The token that marks the end position of the previous returned page. To obtain the next batch of data, call the operation again by using the value of NextToken returned by the previous request. If you call this operation for the first time or want to query all results, set NextToken to an empty string.', example='caeba0bbb2be03f84eb48b699f0a****'),
  virtualHost?: string(name='VirtualHost', description='The name of the vhost to which the exchange belongs.

This parameter is required.', example='test'),
}

model ListDownStreamBindingsResponseBody = {
  code?: int32(name='Code', description='The HTTP status code. The status code 200 indicates that the request is successful.', example='200'),
  data?: {
    bindings?: [ 
      {
        argument?: string(name='Argument', description='The x-match attribute. Valid values:

*   **all:** A headers exchange routes a message to a queue only if all binding attributes of the queue except for x-match match the headers attributes of the message. This value is the default value.
*   **any:** A headers exchange routes a message to a queue if one or more binding attributes of the queue except for x-match match the headers attributes of the message.

This parameter is available only for headers exchanges.', example='test'),
        bindingKey?: string(name='BindingKey', description='The binding key.

*   If the source exchange is not a topic exchange, the binding key must meet the following conventions:

    *   The binding key can contain only letters, digits, hyphens (-), underscores (_), periods (.), forward slashes (/), and at signs (@).
    *   The binding key must be 1 to 255 characters in length.

*   If the source exchange is a topic exchange, the binding key must meet the following conventions:

    *   The binding key can contain letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).
    *   The binding key cannot start or end with a period (.). If a binding key starts with a number sign (#) or an asterisk (\\\\*), the number sign (#) or asterisk (\\\\*) must be followed by a period (.). If the binding key ends with a number sign (#) or an asterisk (\\\\*), the number sign (#) or asterisk (\\\\*) must be preceded by a period (.). If a number sign (#) or an asterisk (\\\\*) is used in the middle of a binding key, the number sign (#) or asterisk (\\\\*) must be preceded and followed by a period (.).
    *   The binding key must be 1 to 255 characters in length.', example='amq.test'),
        bindingType?: string(name='BindingType', description='The type of the object to which the source exchange is bound. Valid values:

*   **QUEUE**
*   **EXCHANGE**', example='QUEUE'),
        destinationName?: string(name='DestinationName', description='The name of the object to which the source exchange is bound.', example='QueueTest'),
        sourceExchange?: string(name='SourceExchange', description='The name of the source exchange.', example='test'),
      }
    ](name='Bindings', description='The bindings.'),
    maxResults?: int32(name='MaxResults', description='The maximum number of entries returned.', example='1'),
    nextToken?: string(name='NextToken', description='The token that marks the end of the current returned page. If this parameter is empty, all data is retrieved.', example='caebacccb2be03f84eb48b699f0a****'),
  }(name='Data', description='The returned data.'),
  message?: string(name='Message', description='The returned message.', example='operation success'),
  requestId?: string(name='RequestId', description='The request ID.', example='9C1E0502-0790-4FDB-8C96-6D5C8D9B7***'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model ListDownStreamBindingsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDownStreamBindingsResponseBody(name='body'),
}

/**
 * @summary Queries all exchanges or queues to which an exchange is bound.
 *
 * @param request ListDownStreamBindingsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListDownStreamBindingsResponse
 */
async function listDownStreamBindingsWithOptions(request: ListDownStreamBindingsRequest, runtime: Util.RuntimeOptions): ListDownStreamBindingsResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDownStreamBindings',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries all exchanges or queues to which an exchange is bound.
 *
 * @param request ListDownStreamBindingsRequest
 * @return ListDownStreamBindingsResponse
 */
async function listDownStreamBindings(request: ListDownStreamBindingsRequest): ListDownStreamBindingsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listDownStreamBindingsWithOptions(request, runtime);
}

model ListExchangeUpStreamBindingsRequest {
  exchangeName?: string(name='ExchangeName', description='The exchange name.

This parameter is required.', example='test'),
  instanceId?: string(name='InstanceId', description='The ID of the ApsaraMQ for RabbitMQ instance.

This parameter is required.', example='1880770869023***'),
  maxResults?: int32(name='MaxResults', description='The maximum number of entries to return.', example='1'),
  nextToken?: string(name='NextToken', description='The token that marks the end position of the previous returned page. To obtain the next batch of data, call the operation again by using the value of NextToken returned by the previous request. If you call this operation for the first time or want to query all results, set NextToken to an empty string.', example='caeba0bbb2be03f84eb48b699f0a****'),
  virtualHost?: string(name='VirtualHost', description='The virtual host (vhost) name.

This parameter is required.', example='test'),
}

model ListExchangeUpStreamBindingsResponseBody = {
  code?: int32(name='Code', description='The HTTP status code. The status code 200 indicates that the request is successful.', example='200'),
  data?: {
    bindings?: [ 
      {
        argument?: string(name='Argument', description='The x-match attribute. Valid values:

*   **all:** A headers exchange routes a message to a queue only if all binding attributes of the queue except for x-match match the headers attributes of the message. This value is the default value.
*   **any:** A headers exchange routes a message to a queue if one or more binding attributes of the queue except for x-match match the headers attributes of the message.

This parameter is available only for headers exchanges.', example='all'),
        bindingKey?: string(name='BindingKey', description='The binding key.

*   If the source exchange is not a topic exchange, the binding key must meet the following conventions:

    *   The binding key can contain only letters, digits, hyphens (-), underscores (_), periods (.), forward slashes (/), and at signs (@).
    *   The binding key must be 1 to 255 characters in length.

*   If the source exchange is a topic exchange, the binding key must meet the following conventions:

    *   The binding key can contain letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).
    *   The binding key cannot start or end with a period (.). If a binding key starts with a number sign (#) or an asterisk (\\\\*), the number sign (#) or asterisk (\\\\*) must be followed by a period (.). If the binding key ends with a number sign (#) or an asterisk (\\\\*), the number sign (#) or asterisk (\\\\*) must be preceded by a period (.). If a number sign (#) or an asterisk (\\\\*) is used in the middle of a binding key, the number sign (#) or asterisk (\\\\*) must be preceded and followed by a period (.).
    *   The binding key must be 1 to 255 characters in length.', example='amq.dle.test'),
        bindingType?: string(name='BindingType', description='The type of the object to which the source exchange is bound. Valid values:

*   **QUEUE**
*   **EXCHANGE**', example='EXCHANGE'),
        destinationName?: string(name='DestinationName', description='The name of the object to which the source exchange is bound.', example='test'),
        sourceExchange?: string(name='SourceExchange', description='The name of the source exchange.', example='dle'),
      }
    ](name='Bindings', description='The bindings.'),
    maxResults?: int32(name='MaxResults', description='The maximum number of entries returned.', example='1'),
    nextToken?: string(name='NextToken', description='The token that marks the end of the current returned page. If this parameter is empty, all data is retrieved.', example='caebacccb2be03f84eb48b699f0a****'),
  }(name='Data', description='The returned data.'),
  message?: string(name='Message', description='The returned message.', example='operation success'),
  requestId?: string(name='RequestId', description='The request ID.', example='2DCCCE88-BC82-4A4F-AF5E-9A759672B***'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model ListExchangeUpStreamBindingsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListExchangeUpStreamBindingsResponseBody(name='body'),
}

/**
 * @summary Queries all queues or exchanges that are bound to an exchange.
 *
 * @param request ListExchangeUpStreamBindingsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListExchangeUpStreamBindingsResponse
 */
async function listExchangeUpStreamBindingsWithOptions(request: ListExchangeUpStreamBindingsRequest, runtime: Util.RuntimeOptions): ListExchangeUpStreamBindingsResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListExchangeUpStreamBindings',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries all queues or exchanges that are bound to an exchange.
 *
 * @param request ListExchangeUpStreamBindingsRequest
 * @return ListExchangeUpStreamBindingsResponse
 */
async function listExchangeUpStreamBindings(request: ListExchangeUpStreamBindingsRequest): ListExchangeUpStreamBindingsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listExchangeUpStreamBindingsWithOptions(request, runtime);
}

model ListExchangesRequest {
  instanceId?: string(name='InstanceId', description='The ID of the ApsaraMQ for RabbitMQ instance.

This parameter is required.', example='amqp-cn-7pp2mwbc****'),
  maxResults?: int32(name='MaxResults', description='The maximum number of entries to return. Valid values: **1 to 100**', example='1'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results. Valid values:

*   If you call this operation for the first time or a next query is not required, leave this parameter empty.
*   If a next query is to be sent, set the value to the value of `NextToken` that is returned from the previous request.', example='AAAANDQBYW1xcC1jbi03cHAybXdiY3AwMGEBdmhvc3QBAXNkZndhYWJhATE2NDkzMTM4OTU5NDIB4o3z1pPwWzk4aYuiRffi8R6-****'),
  virtualHost?: string(name='VirtualHost', description='The vhost name.

This parameter is required.', example='test'),
}

model ListExchangesResponseBody = {
  data?: {
    exchanges?: [ 
      {
        attributes?: map[string]any(name='Attributes', description='The attributes. This parameter is unavailable in the current version.', example='test'),
        autoDeleteState?: boolean(name='AutoDeleteState', description='Indicates whether the exchange was automatically deleted.', example='false'),
        createTime?: long(name='CreateTime', description='The timestamp that indicates when the exchange was created. Unit: milliseconds.', example='1580886216000'),
        exchangeType?: string(name='ExchangeType', description='The exchange type.', example='DIRECT'),
        name?: string(name='Name', description='The exchange name.', example='amq.direct'),
        VHostName?: string(name='VHostName', description='The vhost name.', example='test'),
      }
    ](name='Exchanges', description='The exchanges.'),
    maxResults?: int32(name='MaxResults', description='The maximum number of entries returned.', example='1'),
    nextToken?: string(name='NextToken', description='The token that marks the end of the current returned page.``

*   If the value of this parameter is empty, the next query is not required and the token used to start the next query is unavailable.``
*   If the value of this parameter is not empty, the next query is required, and the value is the token used to start the next query.``', example='AAAANDQBYW1xcC1jbi03cHAybXdiY3AwMGEBdmhvc3QBAXNkZndhYWJhATE2NDkzMTM4OTU5NDIB4o3z1pPwWzk4aYuiRffi8R6-****'),
  }(name='Data', description='The returned data.'),
  requestId?: string(name='RequestId', description='The request ID.', example='FEBA5E0C-50D0-4FA6-A794-4901E5465***'),
}

model ListExchangesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListExchangesResponseBody(name='body'),
}

/**
 * @summary Queries all exchanges that are created in a virtual host (vhost).
 *
 * @param request ListExchangesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListExchangesResponse
 */
async function listExchangesWithOptions(request: ListExchangesRequest, runtime: Util.RuntimeOptions): ListExchangesResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListExchanges',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries all exchanges that are created in a virtual host (vhost).
 *
 * @param request ListExchangesRequest
 * @return ListExchangesResponse
 */
async function listExchanges(request: ListExchangesRequest): ListExchangesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listExchangesWithOptions(request, runtime);
}

model ListInstancesRequest {
  maxResults?: int32(name='MaxResults', description='The maximum number of entries to return. Valid values: 1 to 100.

This parameter is required.', example='1'),
  nextToken?: string(name='NextToken', description='The token that marks the end position of the previous returned page. To obtain the next batch of data, call the operation again by using the value of NextToken returned by the previous request. If you call this operation for the first time or want to query all results, set NextToken to an empty string.', example='caeba0bbb2be03f84eb48b699f0a****'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the instances belong.', example='rg-aekzu74zjgdu4mq'),
}

model ListInstancesResponseBody = {
  data?: {
    instances?: [ 
      {
        autoRenewInstance?: boolean(name='AutoRenewInstance', description='Indicates whether the instance is automatically renewed.', example='false'),
        classicEndpoint?: string(name='ClassicEndpoint', description='The endpoint that is used to access the instance over the classic network. This parameter is no longer available.', example='amqp-cn-st21x7kv****.not-support'),
        encryptedInstance?: boolean(name='EncryptedInstance', description='Indicates whether the encryption at rest feature is enabled for the instance.', example='false'),
        expireTime?: long(name='ExpireTime', description='The timestamp that indicates when the instance expires. Unit: milliseconds.', example='1651507200000'),
        instanceId?: string(name='InstanceId', description='The instance ID', example='amqp-cn-st21x7kv****'),
        instanceName?: string(name='InstanceName', description='The instance name.', example='amqp-cn-st21x7kv****'),
        instanceType?: string(name='InstanceType', description='The instance type.

*   PROFESSIONAL: Professional Edition
*   ENTERPRISE: Enterprise Edition
*   VIP: Enterprise Platinum Edition', example='professional'),
        kmsKeyId?: string(name='KmsKeyId', description='The ID of the Key Management Service (KMS) key used for the data disk.', example='key-bjj66c2a893vmhawtq5fd'),
        maxEipTps?: int32(name='MaxEipTps', description='The maximum number of Internet-based transactions per second (TPS) for the instance.', example='24832'),
        maxQueue?: int32(name='MaxQueue', description='The maximum number of queues on the instance.', example='50'),
        maxTps?: int32(name='MaxTps', description='The maximum number of VPC-based TPS for the instance.', example='5000'),
        maxVhost?: int32(name='MaxVhost', description='The maximum number of vhosts on the instance.', example='50'),
        orderCreateTime?: long(name='OrderCreateTime', description='The timestamp that indicates when the order was created. Unit: milliseconds.', example='1572441939000'),
        orderType?: string(name='OrderType', description='The billing method. Valid values:

*   PrePaid: the subscription billing method.
*   POST_PAID: the pay-as-you-go billing method.', example='PRE_PAID'),
        privateEndpoint?: string(name='PrivateEndpoint', description='The virtual private cloud (VPC) endpoint of the instance.', example='amqp-cn-st21x7kv****.mq-amqp.cn-hangzhou-a.aliyuncs.com'),
        publicEndpoint?: string(name='PublicEndpoint', description='The public endpoint of the instance.', example='amqp-cn-st21x7kv****.mq-amqp.cn-hangzhou-a.aliyuncs.com'),
        resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the instance belongs.', example='rg-aek3axfj2w4czrq'),
        status?: string(name='Status', description='The instance status. Valid values:

*   DEPLOYING: The instance is being deployed.
*   EXPIRED: The instance is expired.
*   SERVING: The instance is running.
*   RELEASED: The instance is released.', example='SERVING'),
        storageSize?: int32(name='StorageSize', description='The disk size. Unit: GB.

>  For Professional Edition instances and Enterprise Edition instances, this parameter is unavailable and \\\\*\\\\*-1\\\\*\\\\* is returned.', example='200'),
        supportEIP?: boolean(name='SupportEIP', description='Indicates whether the instance supports elastic IP addresses (EIPs).', example='true'),
        tags?: [ 
          {
            key?: string(name='Key', description='The tag key.', example='region'),
            value?: string(name='Value', description='The tag value.', example='hangzhou'),
          }
        ](name='Tags', description='The tags that are added to the instance.'),
      }
    ](name='Instances', description='The instances.'),
    maxResults?: int32(name='MaxResults', description='The maximum number of entries returned.', example='1'),
    nextToken?: string(name='NextToken', description='The token that marks the end of the current returned page. If this parameter is empty, all data is retrieved.', example='caebacccb2be03f84eb48b699f0a****'),
  }(name='Data', description='The data returned.'),
  requestId?: string(name='RequestId', description='The request ID.', example='CCBB1225-C392-480E-8C7F-D09AB2CD2***'),
}

model ListInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListInstancesResponseBody(name='body'),
}

/**
 * @summary Queries all AparaMQ for RabbitMQ instances in a region. The returned data includes the basic information, endpoint, and specification limits of each instance.
 *
 * @param request ListInstancesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListInstancesResponse
 */
async function listInstancesWithOptions(request: ListInstancesRequest, runtime: Util.RuntimeOptions): ListInstancesResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListInstances',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries all AparaMQ for RabbitMQ instances in a region. The returned data includes the basic information, endpoint, and specification limits of each instance.
 *
 * @param request ListInstancesRequest
 * @return ListInstancesResponse
 */
async function listInstances(request: ListInstancesRequest): ListInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listInstancesWithOptions(request, runtime);
}

model ListQueueConsumersRequest {
  instanceId?: string(name='InstanceId', description='The ID of the ApsaraMQ for RabbitMQ instance.

This parameter is required.', example='188077086902***'),
  nextToken?: string(name='NextToken', description='The token that marks the end position of the previous returned page. To obtain the next batch of data, call the operation again by using the value of NextToken returned by the previous request. If you call this operation for the first time or want to query all results, set NextToken to an empty string.', example='caeba0bbb2be03f84eb48b699f0a****'),
  queryCount?: int32(name='QueryCount', description='The number of data entries to return. If you do not configure this parameter, the default value 1 is used.

Valid values: 1 to 100.', example='1'),
  queue?: string(name='Queue', description='The name of the queue for which you want to query online consumers.

This parameter is required.', example='queue-rabbit-springboot-advance5'),
  virtualHost?: string(name='VirtualHost', description='The virtual host (vhost) name.

This parameter is required.', example='test'),
}

model ListQueueConsumersResponseBody = {
  data?: {
    consumers?: [ 
      {
        consumerTag?: string(name='ConsumerTag', description='The consumer tag.', example='sgen-1'),
      }
    ](name='Consumers', description='The consumers.'),
    maxResults?: int32(name='MaxResults', description='The maximum number of entries returned.', example='1'),
    nextToken?: string(name='NextToken', description='The token that marks the end of the current returned page. If this parameter is empty, all data is retrieved.', example='caebacccb2be03f84eb48b699f0a****'),
  }(name='Data', description='The returned data.'),
  requestId?: string(name='RequestId', description='The request ID.', example='4409B7D5-E4EC-4EB5-804A-385DCDFCD***'),
}

model ListQueueConsumersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListQueueConsumersResponseBody(name='body'),
}

/**
 * @summary Queries the online consumers of a queue.
 *
 * @description ApsaraMQ for RabbitMQ allows you to query only online consumers.
 *
 * @param request ListQueueConsumersRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListQueueConsumersResponse
 */
async function listQueueConsumersWithOptions(request: ListQueueConsumersRequest, runtime: Util.RuntimeOptions): ListQueueConsumersResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListQueueConsumers',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the online consumers of a queue.
 *
 * @description ApsaraMQ for RabbitMQ allows you to query only online consumers.
 *
 * @param request ListQueueConsumersRequest
 * @return ListQueueConsumersResponse
 */
async function listQueueConsumers(request: ListQueueConsumersRequest): ListQueueConsumersResponse {
  var runtime = new Util.RuntimeOptions{};
  return listQueueConsumersWithOptions(request, runtime);
}

model ListQueueUpStreamBindingsRequest {
  instanceId?: string(name='InstanceId', description='The ID of the ApsaraMQ for RabbitMQ instance.

This parameter is required.', example='1880770869023***'),
  maxResults?: int32(name='MaxResults', description='The maximum number of entries to return.', example='1'),
  nextToken?: string(name='NextToken', description='The token that marks the end position of the previous returned page. To obtain the next batch of data, call the operation again by using the value of NextToken returned by the previous request. If you call this operation for the first time or want to query all results, set NextToken to an empty string.', example='caeba0bbb2be03f84eb48b699f0a****'),
  queueName?: string(name='QueueName', description='The queue name.

This parameter is required.', example='QueueTest'),
  virtualHost?: string(name='VirtualHost', description='The virtual host (vhost) name.

This parameter is required.', example='test'),
}

model ListQueueUpStreamBindingsResponseBody = {
  data?: {
    bindings?: [ 
      {
        argument?: string(name='Argument', description='The x-match attribute. Valid values:

*   **all:** A headers exchange routes a message to a queue only if all binding attributes of the queue except for x-match match the headers attributes of the message. This value is the default value.
*   **any:** A headers exchange routes a message to a queue if one or more binding attributes of the queue except for x-match match the headers attributes of the message.

This parameter is available for only headers exchanges.', example='all'),
        bindingKey?: string(name='BindingKey', description='The binding key.

*   If the source exchange is not a topic exchange, the binding key must meet the following conventions:

    *   The binding key can contain only letters, digits, hyphens (-), underscores (_), periods (.), forward slashes (/), and at signs (@).
    *   The binding key must be 1 to 255 characters in length.

*   If the source exchange is a topic exchange, the binding key must meet the following conventions:

    *   The binding key can contain letters, digits, hyphens (-), underscores (_), periods (.), number signs (#), forward slashes (/), and at signs (@).
    *   The binding key cannot start or end with a period (.). If a binding key starts with a number sign (#) or an asterisk (\\\\*), the number sign (#) or asterisk (\\\\*) must be followed by a period (.). If the binding key ends with a number sign (#) or an asterisk (\\\\*), the number sign (#) or asterisk (\\\\*) must be preceded by a period (.). If a number sign (#) or an asterisk (\\\\*) is used in the middle of a binding key, the number sign (#) or asterisk (\\\\*) must be preceded and followed by a period (.).
    *   The binding key must be 1 to 255 characters in length.', example='amq.test'),
        bindingType?: string(name='BindingType', description='The type of the object to which the source exchange is bound. Valid values:

*   **QUEUE**
*   **EXCHANGE**', example='QUEUE'),
        destinationName?: string(name='DestinationName', description='The name of the object to which the source exchange is bound.', example='QueueTest'),
        sourceExchange?: string(name='SourceExchange', description='The name of the source exchange.', example='test'),
      }
    ](name='Bindings', description='The bindings.'),
    maxResults?: string(name='MaxResults', description='The maximum number of entries returned.', example='1'),
    nextToken?: string(name='NextToken', description='The token that marks the end of the current returned page. If this parameter is empty, all data is retrieved.', example='caebacccb2be03f84eb48b699f0a****'),
  }(name='Data', description='The returned data.'),
  requestId?: string(name='RequestId', description='The request ID.', example='8BFB1C9D-08A2-4859-A47C-403C9EFA2***'),
}

model ListQueueUpStreamBindingsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListQueueUpStreamBindingsResponseBody(name='body'),
}

/**
 * @summary Queries the exchanges that are bound to a queue.
 *
 * @param request ListQueueUpStreamBindingsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListQueueUpStreamBindingsResponse
 */
async function listQueueUpStreamBindingsWithOptions(request: ListQueueUpStreamBindingsRequest, runtime: Util.RuntimeOptions): ListQueueUpStreamBindingsResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListQueueUpStreamBindings',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the exchanges that are bound to a queue.
 *
 * @param request ListQueueUpStreamBindingsRequest
 * @return ListQueueUpStreamBindingsResponse
 */
async function listQueueUpStreamBindings(request: ListQueueUpStreamBindingsRequest): ListQueueUpStreamBindingsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listQueueUpStreamBindingsWithOptions(request, runtime);
}

model ListQueuesRequest {
  instanceId?: string(name='InstanceId', description='The ID of the ApsaraMQ for RabbitMQ instance.

This parameter is required.', example='1880770869023***'),
  maxResults?: int32(name='MaxResults', description='The maximum number of entries to return.

This parameter is required.', example='1'),
  nextToken?: string(name='NextToken', description='The token that marks the end position of the previous returned page. To obtain the next batch of data, call the operation again by using the value of NextToken returned by the previous request. If you call this operation for the first time or want to query all results, set NextToken to an empty string.', example='caeba0bbb2be03f84eb48b699f0a****'),
  virtualHost?: string(name='VirtualHost', description='The virtual host (vhost) name.

This parameter is required.', example='test'),
}

model ListQueuesResponseBody = {
  data?: {
    maxResults?: int32(name='MaxResults', description='The maximum number of entries returned.', example='1'),
    nextToken?: string(name='NextToken', description='The token that marks the end of the current returned page. If this parameter is empty, all data is retrieved.', example='caebacccb2be03f84eb48b699f0a****'),
    queues?: [ 
      {
        attributes?: map[string]any(name='Attributes', description='The attributes.', example='test'),
        autoDeleteState?: boolean(name='AutoDeleteState', description='Indicates whether the queue was automatically deleted.', example='false'),
        createTime?: long(name='CreateTime', description='The time when the queue was created.', example='1580887085240'),
        exclusiveState?: boolean(name='ExclusiveState', description='Indicates whether the queue is an exclusive queue.', example='false'),
        lastConsumeTime?: long(name='LastConsumeTime', description='The time when messages in the queue were last consumed.', example='1680887085240'),
        name?: string(name='Name', description='The queue name.', example='QueueTest'),
        ownerId?: string(name='OwnerId', description='The ID of the ApsaraMQ for RabbitMQ instance to which the queue belongs.', example='1880770869023***'),
        VHostName?: string(name='VHostName', description='The vhost name.', example='test'),
      }
    ](name='Queues', description='The queues.'),
  }(name='Data', description='The returned data.'),
  requestId?: string(name='RequestId', description='The request ID.', example='CE811989-9F02-42CE-97A6-2239CB5C2***'),
}

model ListQueuesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListQueuesResponseBody(name='body'),
}

/**
 * @summary Queries all queues in a vhost of an ApsaraMQ for RabbitMQ instance.
 *
 * @param request ListQueuesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListQueuesResponse
 */
async function listQueuesWithOptions(request: ListQueuesRequest, runtime: Util.RuntimeOptions): ListQueuesResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListQueues',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries all queues in a vhost of an ApsaraMQ for RabbitMQ instance.
 *
 * @param request ListQueuesRequest
 * @return ListQueuesResponse
 */
async function listQueues(request: ListQueuesRequest): ListQueuesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listQueuesWithOptions(request, runtime);
}

model ListVirtualHostsRequest {
  instanceId?: string(name='InstanceId', description='The ID of the ApsaraMQ for RabbitMQ instance.

This parameter is required.', example='1880770869023***'),
  maxResults?: int32(name='MaxResults', description='The maximum number of entries to return. Valid values: **1 to 100**

This parameter is required.', example='2'),
  nextToken?: string(name='NextToken', description='The token that marks the end position of the previous returned page. To obtain the next batch of data, call the operation again by using the value of NextToken returned by the previous request. If you call this operation for the first time or want to query all results, set NextToken to an empty string.', example='caeba0bbb2be03f84eb48b699f0a****'),
}

model ListVirtualHostsResponseBody = {
  data?: {
    maxResults?: int32(name='MaxResults', description='The maximum number of entries returned.', example='2'),
    nextToken?: string(name='NextToken', description='The token that marks the end of the current returned page. If this parameter is empty, all data is retrieved.', example='caebacccb2be03f84eb48b699f0a****'),
    virtualHosts?: [ 
      {
        name?: string(name='Name', description='The vhost name.', example='test'),
      }
    ](name='VirtualHosts', description='The vhosts.'),
  }(name='Data', description='The returned data.'),
  requestId?: string(name='RequestId', description='The request ID.', example='EF4DB019-DA4A-4CE3-B220-223BBC93F***'),
}

model ListVirtualHostsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListVirtualHostsResponseBody(name='body'),
}

/**
 * @summary Queries all virtual hosts (vhosts) on an ApsaraMQ for RabbitMQ instance.
 *
 * @param request ListVirtualHostsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListVirtualHostsResponse
 */
async function listVirtualHostsWithOptions(request: ListVirtualHostsRequest, runtime: Util.RuntimeOptions): ListVirtualHostsResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListVirtualHosts',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries all virtual hosts (vhosts) on an ApsaraMQ for RabbitMQ instance.
 *
 * @param request ListVirtualHostsRequest
 * @return ListVirtualHostsResponse
 */
async function listVirtualHosts(request: ListVirtualHostsRequest): ListVirtualHostsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listVirtualHostsWithOptions(request, runtime);
}

model UpdateInstanceRequest {
  clientToken?: string(name='ClientToken', description='The client token.', example='c2c5d1274axxxxxxxx'),
  edition?: string(name='Edition'),
  encryptedInstance?: boolean(name='EncryptedInstance', description='实例是否开通数据存储加密功能', example='false'),
  instanceId?: string(name='InstanceId', description='The ID of the ApsaraMQ for RabbitMQ instance.

This parameter is required.', example='amqp-cn-jtexxxxx'),
  instanceType?: string(name='InstanceType', description='The instance edition. Valid values for subscription instances:

*   professional: Professional Edition
*   enterprise: Enterprise Edition
*   vip: Enterprise Platinum Edition.

If your instance is a pay-as-you-go instance, you do not need to configure this parameter.', example='professional'),
  kmsKeyId?: string(name='KmsKeyId', description='使用同地域下KMS密钥ID', example='key-bjj66c2a893vmhawtq5fd'),
  maxConnections?: int32(name='MaxConnections', description='The maximum number of connections that can be created on the instance.', example='1000'),
  maxEipTps?: long(name='MaxEipTps', description='The peak TPS for accessing the instance over the Internet.', example='128'),
  maxPrivateTps?: long(name='MaxPrivateTps', description='The peak transactions per second (TPS) for accessing the instance in a virtual private cloud (VPC).', example='1000'),
  modifyType?: string(name='ModifyType', description='The type of the configuration change. Valid values:

*   UPGRADE
*   DOWNGRADE

This parameter is required.', example='UPGRADE'),
  provisionedCapacity?: int32(name='ProvisionedCapacity'),
  queueCapacity?: int32(name='QueueCapacity', description='The maximum number of queues that can be created on the instance.', example='1000'),
  serverlessChargeType?: string(name='ServerlessChargeType', description='The billing method of the serverless instance. Valid values:

*   onDemand: You are charged based on your actual usage.', example='onDemand'),
  storageSize?: int32(name='StorageSize', description='The size of the storage space that can be used to store messages.', example='7'),
  supportEip?: boolean(name='SupportEip', description='Specifies whether elastic IP addresses (EIPs) are supported.', example='false'),
  supportTracing?: boolean(name='SupportTracing', description='Specifies whether to enable the message trace feature.', example='false'),
  tracingStorageTime?: int32(name='TracingStorageTime', description='The retention period of message traces.

Valid values:

*   3
*   7
*   15', example='3'),
}

model UpdateInstanceResponseBody = {
  code?: int32(name='Code', description='The response code. The status code 200 indicates that the request was successful.', example='200'),
  data?: any(name='Data', description='The returned data, which includes orderId and instanceId. Sample returned data:

```json
"Data": {
    "instanceId": "amqp-cn-xxxxx",
    "orderId": 22222
  }
```', example='{“instanceId”: “amqp-cn-jtexxxxx”, “orderId”: 2222222}'),
  message?: string(name='Message', description='The returned message.', example='InstanceNotExist'),
  requestId?: string(name='RequestId', description='The request ID.', example='628705FD-03EE-4ABE-BB21-E1672960***'),
  statusCode?: string(name='StatusCode', description='The response code.', example='200'),
  success?: string(name='Success', description='Indicates whether the request was successful.', example='true'),
}

model UpdateInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateInstanceResponseBody(name='body'),
}

/**
 * @summary Upgrades or downgrades the configurations of an ApsaraMQ for RabbitMQ instance.
 *
 * @param request UpdateInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateInstanceResponse
 */
async function updateInstanceWithOptions(request: UpdateInstanceRequest, runtime: Util.RuntimeOptions): UpdateInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.edition)) {
    query['Edition'] = request.edition;
  }
  if (!Util.isUnset(request.encryptedInstance)) {
    query['EncryptedInstance'] = request.encryptedInstance;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.instanceType)) {
    query['InstanceType'] = request.instanceType;
  }
  if (!Util.isUnset(request.kmsKeyId)) {
    query['KmsKeyId'] = request.kmsKeyId;
  }
  if (!Util.isUnset(request.maxConnections)) {
    query['MaxConnections'] = request.maxConnections;
  }
  if (!Util.isUnset(request.maxEipTps)) {
    query['MaxEipTps'] = request.maxEipTps;
  }
  if (!Util.isUnset(request.maxPrivateTps)) {
    query['MaxPrivateTps'] = request.maxPrivateTps;
  }
  if (!Util.isUnset(request.modifyType)) {
    query['ModifyType'] = request.modifyType;
  }
  if (!Util.isUnset(request.provisionedCapacity)) {
    query['ProvisionedCapacity'] = request.provisionedCapacity;
  }
  if (!Util.isUnset(request.queueCapacity)) {
    query['QueueCapacity'] = request.queueCapacity;
  }
  if (!Util.isUnset(request.serverlessChargeType)) {
    query['ServerlessChargeType'] = request.serverlessChargeType;
  }
  if (!Util.isUnset(request.storageSize)) {
    query['StorageSize'] = request.storageSize;
  }
  if (!Util.isUnset(request.supportEip)) {
    query['SupportEip'] = request.supportEip;
  }
  if (!Util.isUnset(request.supportTracing)) {
    query['SupportTracing'] = request.supportTracing;
  }
  if (!Util.isUnset(request.tracingStorageTime)) {
    query['TracingStorageTime'] = request.tracingStorageTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateInstance',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Upgrades or downgrades the configurations of an ApsaraMQ for RabbitMQ instance.
 *
 * @param request UpdateInstanceRequest
 * @return UpdateInstanceResponse
 */
async function updateInstance(request: UpdateInstanceRequest): UpdateInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateInstanceWithOptions(request, runtime);
}

model UpdateInstanceNameRequest {
  instanceId?: string(name='InstanceId', description='The ID of the ApsaraMQ for RabbitMQ instance for which you want to update the name.

This parameter is required.', example='amqp-cn-zvp2ajsj****'),
  instanceName?: string(name='InstanceName', description='The new name of the instance. No limits are imposed on the value. We recommend that you set this parameter to a maximum of 64 characters in length.

This parameter is required.', example='amqp-cn-ZVp2ajsj****'),
}

model UpdateInstanceNameResponseBody = {
  code?: int32(name='Code', description='The returned HTTP status code.', example='200'),
  data?: string(name='Data', description='The returned data.', example='true'),
  message?: string(name='Message', description='The error message that is returned when an error occurs during the update of the instance name.', example='InstanceNotExist'),
  requestId?: string(name='RequestId', description='The request ID.', example='6DC68EC9-0E76-5435-B8C0-FF9492B4****'),
  success?: boolean(name='Success', description='The returned message that indicates the request is successful.', example='true'),
}

model UpdateInstanceNameResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateInstanceNameResponseBody(name='body'),
}

/**
 * @summary Updates the name of an ApsaraMQ for RabbitMQ instance. After an ApsaraMQ for RabbitMQ instance is created, the ID of the instance is used as its name by default. You can specify a custom name for an instance to facilitate instance identification.
 *
 * @param request UpdateInstanceNameRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateInstanceNameResponse
 */
async function updateInstanceNameWithOptions(request: UpdateInstanceNameRequest, runtime: Util.RuntimeOptions): UpdateInstanceNameResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.instanceName)) {
    query['InstanceName'] = request.instanceName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateInstanceName',
    version = '2019-12-12',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Updates the name of an ApsaraMQ for RabbitMQ instance. After an ApsaraMQ for RabbitMQ instance is created, the ID of the instance is used as its name by default. You can specify a custom name for an instance to facilitate instance identification.
 *
 * @param request UpdateInstanceNameRequest
 * @return UpdateInstanceNameResponse
 */
async function updateInstanceName(request: UpdateInstanceNameRequest): UpdateInstanceNameResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateInstanceNameWithOptions(request, runtime);
}

